Subject: Re: Added "Stranded on Rigel 5" by Sean Walsh to BallyAlley.com From: Richard Degler Date: November 28, 2010 Both versions [of "Stranded on Rigel 5" by Sean Walsh] are exactly the same, except for the comments on one and different Direct Command loaders : .STRANDED ON RIGEL 5 .BY SEAN WALSH .ARCADIAN VOL.4 PG.72&73 for A=-24576to -22776;%(A)=KP;next A;%(20050)=-22886;:return ;run ... or as printed in the Arcadian : A = -24576;B= -22784;for N=Ato B;%(N)=KP;next N;%(20050)=B-102;:return ;run Not sure why there are extra spaces in the second version After that, the Bally Basic program follows identically on the tape(s) beginning at Line 6 - with the line number digits already converted to words (saves space on tape, no difference in memory usage.) : 6 W=20200;Y=W+13;R=W+3;F=-40;BC=0;FC=126;clear ;for A=-80to 80;line A,- 40,0;F=F+rnd (3)-2;if F<-40F=-40 7 line A,F,1;if A>50box rnd (160)-80,rnd (70)-40,1,1,1 10 next A;print " STRANDED ON RIGEL 5";P=0;for A=17to 20;&(A)=7;next A;&(16)=92;&(22)=-1;if KPinput S 80 gosub 900;O=0;K=20;gosub 749+(P>0) 100 clear ;box -50,32,60,1,1;box -42,-5,1,74,1;P=0;box 0,0,3,87,1;box - 5,0,10,2,1;%(Y)=128;%(R)=8774 105 CALLW;for A=0to 4 110 @(A)=rnd (10)-1;for Q=0to A-1;if A=0next A 111 if @(A)=@(Q)goto 110 120 next Q;next A;print "input CODE";print 124 for P=1to 8;for A=5to 9 125 @(A)=KP-48;if (@(A)<0)+(@(A)>9)goto 125 126 TV=@(A)+48;next A;C=0;D=0;for A=0to 4;if @(A)=@(A+5)C=C+1 140 for Q=5to 9;if @(A)=@(Q)D=D+1 143 next Q;next A;CX=-36;print #0,D,"-",#0,C;if C=5goto 180 161 for A=17to 20;&(A)=-1;next A;&(16)=33;&(22)=Pmul 31;next P 170 %(Y)=129;%(R)=67;CALLW;N=9 172 for A=32to Nstep -5;&(18)=-A;box -7,A,2,5,3;box -7,A,2,5,3;next A;box - 7,N,7,2,2;N=N-2;if N>2goto 172 175 gosub 700;goto 190 180 box 0,6,3,10,2;box 16,0,35,1,1;box 40,-30,50,5,1;box 40,-13,30,30,1;box 40,4,20,5,1;box 40,14,5,16,1;box 40,-30,5,5,2 190 gosub 900;CX=12;CY=40;print "CODE WAS:";CX=21;for A=0to 4;print #0,@(A),;next A;if KPif P=9goto 100 500 K=0;gosub 750 510 clear ;E=0;for A=1to 30;box rnd (160)-80,rnd (88)-44,1,1,1;next A;for T=1to 3;gosub 600;next T;V=80;H=V 520 for N=1to rnd (8-S)mul 14;H=H+JX(1)mul 4;%(R)=20480+H;CALLW;if TR(1)&(22)=-1;gosub 580 530 CALLW;next N;for A=48-Tmul 10to 40step 10;for B=-74to 80step 16;if PX(B,A)gosub 600;T=T+1;goto 520 540 next B;T=T-1;next A;CALLW;goto 800 580 for A=-32to 40step 10;box H-74,A,2,5,3;box H-74,A,2,5,3 581 &(18)=A;if PX(H-74,A)box H-75,A+1,11,9,2;&(21)=-1;&(23)=9;gosub 900;return 590 next A;E=E+1;return 600 %(Y)=129;for A=0to 9;%(R)=2560mul T+Amul 16;CALLW;next A;%(Y)=128;if T#8return 610 for A=1to 40;MU=3;next A;gosub 700;goto 510 700 for Z=1to 7;&(21)=-1;&(18)=99;&(19)=99;&(16)=1;&(23)=9;BC=7-Z;next Z;gosub 900;O=O+1;if O<5return 710 clear ;print "YOUR 5 LIVES ARE GONE";print "YOU HAVE FAILED!";if KPgoto 80 749 for A=0to 10;C=W+Amul 2;%(C)=@(A);next A 750 C=Y+7;for A=31-Kto 50-K;C=C+2;%(C)=@(A);next A;return 800 for A=16to 19;&(A)=60;next A;&(21)=89;&(22)=-1;&(23)=61;for A=1to 15;print ;next A;gosub 900;print "GREAT! 810 print "EFFICIENCY IS",100-Omul 9-P-E+Smul 3,"%";if KPgoto 80 900 for Z=16to 23;&(Z)=0;next Z;return After Line 900 is the "end of program marker" and the "@(array)" which contains the "machine language" section as follows : ; DW $FF00 ; -256 [end of Basic program flag] ORG $4EE8 ; ****** Start from BALLY Basic with CALL20200 *** <-- Variable 'W' is pointed here L4EE8: PUSH DE ; store Basic Program pointer <-- copied starting from @(0) SYSSUK STRDIS ; UPI STRing DISplay DB $4B ; ... X = 75 <-- Variable 'R' is pointed here DB $00 ; ... Y = 0 DB $28 ; ... Options = 40 DW L4EF2 ; ... String Address = 20210 ; POP DE ; restore Basic Program pointer RET ; ****** Formatting Text string *** L4EF2: DB $70,$F8,$4E ; load IX with 20216 for Alternate Font Descriptor DB $81,$00 ; ASCII $80 and/or $81 (Null Terminated) <-- Variable 'Y' ; L4EF7: 1 spare byte for ?? DB $30 ; ****** Alternate Font Descriptor block *** (at 20216) L4EF8: DB $80 ; FonT BASE character = 128 (normally 32) DB $09 ; ... Frame X Size width = 9 DB $0F ; ... Frame Y Size height = 15 DB $02 ; ... X size for char in BYTEs = 2 DB $09 ; ... Y SIZe height in rows = 9 DW $4EFF ; ... Pattern Table address = 20223 ; ****** Special Two-character 9 x 15 Fonts *** <-- 20 words moved by Basic to 20222 L4EFF: ; *** Char $80 Human, First shape DB $38,$00 ; . . X X X . . . . . . . . . . . <-- @(11 to 30) DB $FE,$00 ; X X X X X X X . . . . . . . . . DB $FE,$00 ; X X X X X X X . . . . . . . . . DB $BA,$00 ; . . . X . . . . . . . . . . . . DB $38,$00 ; . . X X X . . . . . . . . . . . DB $7C,$00 ; . X X X X X . . . . . . . . . . DB $6C,$00 ; . X X . X X . . . . . . . . . . DB $C6,$00 ; X X . . . X X . . . . . . . . . DB $00,$00 ; . . . . . . . . . . . . . . . . ; *** Char $81 Lander, First shape DB $07,$00 ; . . . . . X X X . . . . . . . . DB $3F,$E0 ; . . X X X X X X X X X . . . . . DB $32,$60 ; . . X X . . X . . X X . . . . . DB $3F,$E0 ; . . X X X X X X X X X . . . . . DB $15,$40 ; . . . X . X . X . X . . . . . . DB $17,$40 ; . . . X . X X X . X . . . . . . DB $3A,$E0 ; . . X X . . . . X X X . . . . . DB $02,$00 ; . . . . . . X . . . . . . . . . DB $07,$00 ; . . . . . X X X . . . . . . . . ; 3 filler bytes (not used) DB $00,$00 ; . . . . . . . . . . . . . . . . <-- 3 additional bytes DB $00,$4E ; . . . . . . . . . X . . X X X . <-- high byte of address ; *** Char $80 Human, Second shape DB $04,$00 ; . . . . . X . . . . . . . . . . <-- @(31 to 50) DB $04,$00 ; . . . . . X . . . . . . . . . . DB $04,$00 ; . . . . . X . . . . . . . . . . DB $0E,$00 ; . . . . X X X . . . . . . . . . DB $1F,$00 ; . . . X X X X X . . . . . . . . DB $1F,$00 ; . . . X X X X X . . . . . . . . DB $1F,$00 ; . . . X X X X X . . . . . . . . DB $3B,$80 ; . . X X . . . X X . . . . . . . DB $7B,$C0 ; . X X X . . . X X X . . . . . . ; *** Char $81 Lander, Second shape DB $1F,$00 ; . . . X X X X X . . . . . . . . DB $7F,$C0 ; . X X X X X X X X X . . . . . . DB $AA,$A0 ; X . X . X . X . X . X . . . . . DB $7F,$C0 ; . X X X X X X X X X . . . . . . DB $1F,$00 ; . . . X X X X X . . . . . . . . DB $0E,$00 ; . . . . X X X . . . . . . . . . DB $7F,$C0 ; . X X X X X X X X X . . . . . . DB $64,$C0 ; . X X . . X . . X X . . . . . . DB $F1,$E0 ; X X X X . . . X X X X . . . . . ; 14 filler bytes ?? DB $00,$00 ; . . . . . . . . . . . . . . . . <-- 3 additional bytes DB $00,$00 ; . . . . . . . . . . . . . . . . DB $00,$00 ; . . . . . . . . . . . . . . . . DB $00,$00 ; . . . . . . . . . . . . . . . . DB $00,$00 ; . . . . . . . . . . . . . . . . DB $00,$00 ; . . . . . . . . . . . . . . . . DB $00,$00 ; . . . . . . . . . . . . . . . . ; end of file END As you can see, the machine code portion is moved by the Basic program before being used, and either two-character font can also be copied into position. Hope everyone has "Lucinda Terminal" font - the regular "Terminal" changed   to á in the preview. Used
code
instead of text as one eats all blank lines. If this listing is too fragged up, and for my comments on the Basic listing, see : http://tech.groups.yahoo.com/group/ballyalley/files/STRANDED.ASM Richard Degler